 import java.applet.Applet;
 import java.awt.*;
 
 public class SoccerField extends Applet{
   public void paint(Graphics build){ 
         
      setBackground(Color.black);      
      //-----------------------------------//
     // Parameters for creating the field //
    // Sizes                             //
    final int W = 300;                  //
    final int L = 200;                 //
    // Origin:                        //                                   
    int[] o = new int[2];            //
    o[0] = 400;                     //
    o[1] = 100;                    //
    //----------------------------//----------------//
    // Coordinate arrays for creating the polygon  //  
    int[] x = coord(o[0],o[0]+W,o[0]+W/2,o[0]-W); //
    int[] y = coord(o[1],o[1],o[1]+L,o[1]+L);    //
    //------------------------------------------//      
    
    // Build the field
    build.setColor(new Color(36,236,41)); 
    build.fillPolygon(x,y,4);
    //----------------------------------------
    // Build the lower goal
    build.setColor(Color.white);
    build.fillRect(o[0]-W+150,o[1]+L-80,150,80);
    
    build.setColor(new Color(36,236,41,100));
    build.fillRect(o[0]-W+160,o[1]+L-70,130,70);
    //-----------------------------------------
    // Build the upper goal
    build.setColor(Color.white);
    build.fillRect(o[0]+100,o[1]-54,100,54);
    
    build.setColor(new Color(0,0,0,100));
    build.fillRect(o[0]+107,o[1]-47,86,47);
    //----------------------------------------
    //Build the field lines
    build.setColor(new Color(255,255,255));
    build.drawLine(x[0],y[0],x[1],y[1]);
    build.drawLine(x[1],y[1],x[2],y[2]);
    build.drawLine(x[2],y[2],x[3],y[3]);
    build.drawLine(x[3],y[3],x[0],y[0]);
    //----------------------------------------
    // Build the middle line
    final double MIDDLE = 0.6;
    int[] middle1 = new int[2];
    int[] middle2 = new int[2];
    
    middle1[0] = (int) (x[2]+(x[1]-x[2])*MIDDLE);
    middle1[1] = (int) (y[1]+(y[2]-y[1])*(1-MIDDLE));
    middle2[0] = (int) (x[3]+(x[0]-x[3])*MIDDLE);
    middle2[1] = (int) (y[0]+(y[3]-y[0])*(1-MIDDLE));
    
    build.setColor(Color.white);
    build.drawLine(middle1[0],middle1[1],middle2[0],middle2[1]);
    //build.drawLine();
    }
    public int[] coord(int a, int b, int c, int d){
      int[] array = new int[4];
      array[0] = a; array[1] = b; array[2] = c; array[3] = d;
      
      return array;
    }
 }
 